const webpackMerge = require('webpack-merge');
const webpack = require('webpack');
const baseWebpackConfig = require('./base.config.js');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const  path = require('path');

var ExtractTextWebpackPlugin = require('extract-text-webpack-plugin');

var webpackConfig = webpackMerge(baseWebpackConfig, {
    mode: 'development',
    devtool: 'inline-source-map',
    plugins: [
        new webpack.HashedModuleIdsPlugin(),
        new ExtractTextWebpackPlugin({
                filename: '[name].css',
                allChunks: true
        }),
        new BrowserSyncPlugin({
            host: 'localhost',
            port: 3006,
            proxy: 'http://localhost:8099'
        }, {
            reload: true 
        })
    ],
    devServer: {
        contentBase: path.join(__dirname, "../dist"),
        historyApiFallback: true,//不跳转
        noInfo: true,
        inline: true,//实时刷新
        port: 8099,
        disableHostCheck: true,
    }
});
module.exports = webpackConfig;
